<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
</head>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <form class="form-horizontal" onsubmit="return false" id="form" enctype="multipart/form-data">
        <fieldset>
            <div class="form-group">
                <label class="col-md-2 control-label">员工</label>
                <div class="col-md-10" style="width: 300px">
                    <input type="text" class="form-control" id="userId" name="userId" readonly/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">签订时间</label>
                <div class="col-md-10" style="width: 200px">
                    <input type="text" class="form-control" placeholder="签订时间" id="signDate" name="signDate" readonly/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">到期时间</label>
                <div class="col-md-10" style="width: 200px">
                    <input type="text" class="form-control" placeholder="到期时间" id="expireDate" name="expireDate" readonly/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">合同图片</label>
                <div class="col-md-10">
                    <div class="layui-upload-list">
                        <img class="layui-upload-img" id="image_file" width="50%" height="50%">
                        <p id="demoText"></p>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row" align="center">
                    <div class="col-md-12">
                        <button class="btn btn-primary" onclick="location.href='contractList.html'">返回</button>
                    </div>
                </div>
            </div>

        </fieldset>
    </form>
</div>
<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
<script type="text/javascript" src="../../js/bootstrap/bootstrap-select.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/my/roles/role.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="../../js/dict.js"></script>
<script type="text/javascript" src="../../js/my/queryData.js?v=2"></script>
<script type="text/javascript">
    layui.use(['layer', 'laydate', 'upload'], function () {
        var layer = layui.layer;
        var laydate = layui.laydate;
        laydate.render({
            elem: '#signDate'
        });
        laydate.render({
            elem: '#expireDate'
        });
    });

    initData();

    function initData() {
        var id = getUrlParam("id");
        if (id != "") {
            $.ajax({
                type: 'get',
                url: '/empContract/' + id,
                async: false,
                success: function (data) {
                    $("#userId").val("姓名：" + data.user.name + "，证件号码：" + data.user.cerNo);
                    $("#signDate").val(data.signDate);
                    $("#expireDate").val(data.expireDate);
                    $("#image_file").attr("src", "data:image/jpeg;base64," + data.url);
                }
            });
        }
    }

</script>
</body>
</html>